import ValAjax from '@/utils/ValAjax'
import { delToken } from '@/utils/storage'
// import { Toast } from 'vant'
// 登录
export const userLogin = data => ValAjax.post('/user/login', data)

// 注册
export const userRegister = data => ValAjax.post('/user/registered', data)

// 获取用户信息
export const getUserInfo = () => ValAjax.get('/user')

// 退出登录
export const logout = () => {
  // let forbidClick = true
  // Toast.loading({
  //   message: '登出中...',
  //   forbidClick
  // })
  ValAjax.post('/user/logout')
  setTimeout(() => {
    delToken()
    // forbidClick = false
  }, 0)
}

// 获取收藏
export const getStar = () => ValAjax.get('/user/favorites')
// 获取已发布房源
export const getRent = () => ValAjax.get('/user/houses')
